
var winbdztree = Ext.namespace('win.bdz');

winbdztree.win = {

	openCommentWindow: function(){
		
		var temp = {

			// ----------------------------------------------------------------------
			// 加载列表
			// ----------------------------------------------------------------------
			tree : new Ext.tree.TreePanel({
				
	            id:"win_bdz_tree",   
	            root : new Ext.tree.AsyncTreeNode({   
	        		id : "0", 
	        		draggable:false, 
	        		singleClickExpand:true, 
	        		text : treetitle
				}),   
				loader:new Ext.tree.TreeLoader({
	        		url : 'equip!getselectBdzTree.do?parentid=',
	        		listeners:{"beforeload":function(loader, node){ 
							loader.url ='equip!getselectBdzTree.do?parentid=' + node.id ;
	        		}}
	   		 	}),
		        useArrows:true,
		        autoScroll:true,
		        animate:true,
		        listeners:{'click': function(node) {
		        	if( node.attributes.leaf) {
		        		try {
							document.getElementById('entity.bdzid').value = node.parentNode.id.replace('bdz','');
							document.getElementById('entity.typeid').value = node.id;
							document.getElementById('bdzname').value = node.parentNode.text;
							document.getElementById('typename').value = node.text;
							win.close();
		        		} catch(e) {
		        			
		        		}
		        	} else {
		        		Ext.MessageBox.alert("提示","请选择隔断或者间隔");
		        	}
		        }}
			})	
		}
		
		var win = new Ext.Window({
				closeAction :'close',
				width: 350,
				height: 450,
				layout: 'fit',
				resizable : false,
				modal: true,
				plain: true,
		        items:[{
			        	title:'变电站信息',
			            region:'center',
			            layout:'fit',
			            items:[temp.tree] 	,
			            split:true,
			            collapsible:true,
			            defaults:{autoScroll:true,border:false}
		        	}]
	
			});
			
		win.show();

	}

}